home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 43.zip
/
Sources C - WorkDisk II.adf
/
sin1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1987-01-02
|
3KB
|
167 lines
#include "exec/types.h"
#include "intuition/intuition.h"
#include "math.h"
struct IntuitionBase *IntuitionBase;
struct Window *NoBorder;
struct GfxBase *GfxBase;
struct RastPort *r;
struct Screen *Scrn;
struct IntuiMessage *mesg;
#define INTUITION_REV 29
#define GRAPHICS_REV 29
main()
{
ULONG flags,mclass;
SHORT x,y,w,h,d,c0,c1,factor,k;
USHORT mode;
VOID OpenALL();
register double i, j;
OpenALL();
/* ======Open een hires custom screen====== */
y=0;
w=640;
h=400;
d=4;
c0=0x00;
c1=0x01;
mode=HIRES;
Scrn=(struct Screen *)
make_screen(y,w,h,d,c0,c1,mode,NULL);
/* ======open een borderless window ====== */
x=y=0;
w=640;
h=200;
flags = ACTIVATE|SMART_REFRESH|BORDERLESS;
NoBorder=(struct Window *)
make_window(x,y,w,h,NULL,flags,Scrn);
/* ======zetten van colorregisters====== */
SetRGB4(ViewPortAddress(NoBorder),0,0,0,0);
SetRGB4(ViewPortAddress(NoBorder),1,15,15,15); /* pen 1 wit */
r=NoBorder->RPort;
SetAPen(r,1);
factor = 50; /* amplitude */
for(i=0;i<640;i++)
{
j=factor*sin((double)i*0.0174533);
for(k=0;k<100;k=+4)
WritePixel(r,(long)i,(long)j+51+k);
}
/* ======Close de windows in volgorde====== */
Wait(1<<NoBorder->UserPort->mp_SigBit);
while((mesg=(struct IntuiMessage *)
GetMsg(NoBorder->UserPort))!=NULL)
{
mclass=mesg->Class;
ReplyMsg(mesg);
}
if(mclass==MOUSEBUTTONS || mclass==WINDOWCLOSE)
{
CloseWindow(NoBorder);
CloseScreen(Scrn);
}
}
VOID OpenALL()
{
/*==Intuition==*/
IntuitionBase=(struct IntuitionBase *)
OpenLibrary("intuition.library",INTUITION_REV);
if(IntuitionBase==NULL)
exit(FALSE);
/*==Graphics Library==*/
GfxBase=(struct GfxBase *)
OpenLibrary("graphics.library",GRAPHICS_REV);
if(GfxBase==NULL)
exit(FALSE);
}
make_window(x,y,w,h,name,flags,screen)
SHORT x,y,w,h;
UBYTE *name;
ULONG flags;
struct Screen *screen;
{
struct NewWindow NewWindow;
NewWindow.LeftEdge = x;
NewWindow.TopEdge = y;
NewWindow.Width = w;
NewWindow.Height = h;
NewWindow.DetailPen = -1;
NewWindow.BlockPen = -1;
NewWindow.Title = name;
NewWindow.Flags = flags;
NewWindow.IDCMPFlags = CLOSEWINDOW|MOUSEBUTTONS;
NewWindow.Type = CUSTOMSCREEN;
NewWindow.FirstGadget = NULL;
NewWindow.CheckMark = NULL;
NewWindow.Screen = screen;
NewWindow.BitMap = NULL;
NewWindow.MinWidth = 0;
NewWindow.MinHeight = 0;
NewWindow.MaxWidth = 0;
NewWindow.MaxHeight = 0;
return(OpenWindow(&NewWindow));
}
make_screen(y,w,h,d,color0,color1,mode,name)
SHORT y,w,h,d;
UBYTE color0,color1,*name;
USHORT mode;
{
struct NewScreen NewScreen;
NewScreen.LeftEdge = 0;
NewScreen.TopEdge = y;
NewScreen.Width = w;
NewScreen.Height = h;
NewScreen.Depth = d;
NewScreen.DetailPen = color0;
NewScreen.BlockPen = color1;
NewScreen.ViewModes = mode;
NewScreen.Type = CUSTOMSCREEN;
NewScreen.Font = NULL;
NewScreen.DefaultTitle = name;
NewScreen.Gadgets = NULL;
NewScreen.CustomBitMap = NULL;
return(OpenScreen(&NewScreen));
}
tekenpixel(col,rast,s,t)
long col,s,t;
struct RastPort *rast;
{
}